import axios from './axios';

export default function $axios(url, data = {}, type = "GET", config = {}) {
  return new Promise((resolve, reject) => {
      let promise;
      if (type.toLocaleLowerCase() === "get") {
        promise = axios.get(url, {params: data})
      } else {
        promise = axios.post(url, data, config)
      }
      promise.then(res => {
        resolve(res);
      }).catch(err => {
        console.error(err);
      })
    }
  )
}
